<?

//include_once("../../fckeditor/fckeditor.php");

include_once("../../config.inc.php");	

include_once ("../../class/mysqldb.inc.php");

$db=new mysqldb();

$TypeName = trim($TypeName);

if($_POST['act']=="edit"){

	$sql="update hy_b_sendtype set TypeName = '".$TypeName."' , Money = ".$Money.",Content='".$Content."' where ID = ".$id;

	$db->query($sql);

	exit("<script>location.href='sendmethod.php';</script >");

}else if($_POST['act']=="add"){

	$sql="insert into hy_b_sendtype (TypeName,Money,Content) values('".$TypeName."','".$Money."','".$Content."')";

	$db->query($sql);

	//echo $sql;

	exit("<script>location.href='sendmethod.php';</script >");

}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Administrator's Control Panel</title>

<link href="../css/style.css" rel="stylesheet" type="text/css" />

<script language="JavaScript">

<!--

function update(id,w){

	name = document.getElementById("TypeName"+id).value;

	money = document.getElementById("Money"+id).value;

	location.href="?act=edit&id="+id+"&TypeName="+name+"&Money="+money;

}

function add(){

	

}

function mOvr(src,clrOver)

{	

   if (!src.contains(event.fromElement))

	{	 src.bgColor = clrOver;

	}

}

function mOut(src,clrIn)

{	if (!src.contains(event.toElement))

	{	src.bgColor = clrIn;

	}

}

function checkFrm(dom){

	if(dom.TypeName.value=="")

	{

		alert('请输入配送方式');

		dom.TypeName.focus();

		return false;

	}

	else if(dom.Money.value==""||isNaN(dom.Money.value))

	{

		alert('配送费用应该为数字');

		dom.Money.focus();

		return false;

	}

	else

	{

		return true;

	}

}

//-->

</script>

</head>

<body id="main" >

<?

$sql="SELECT * FROM `hy_b_sendtype` where ID='$id' ";

$db->query($sql);

$rs=$db->get_data();

if($rs)

{

	$strTypeName=$rs[0]['TypeName'];

	$fltMoney=$rs[0]['Money'];

	$strContent=$rs[0]['Content'];

	$act="edit";

}

else

{

	$act="add";

}

?>

<table summary="" id="pagehead" cellpadding="0" cellspacing="0" border="0" width="100%">

  <tr>

    <td><h1>配送方式 </h1></td>

    <td width="100"><a href="sendmethod_add.php">新增</a></td>

  </tr>

</table> 

<div style="height:20px;">&nbsp;</div>

<div style="background-color:#CCC; font-size:16px;">新增</div>

<div>

    <form action="" method="post" onsubmit="return checkFrm(this)">

        <input name="act" type="hidden" value="<?=$act?>" />

        <input name="id" type="hidden" value="<?=$id?>" />

        配送方式 :<input type="text" name="TypeName" id="TypeName" value="<?=$strTypeName?>"/><br />

        配送费用:<input type="text" name="Money" id="Money" value="<?=$fltMoney?>"/><br />

        描述:

   
	  <?php
			include_once "../../ckeditor/ckeditor.php";
			$CKEditor = new CKEditor();
			
			$config['toolbar'] = array(
	array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike', 'Link', 'Unlink', 'Anchor'),
);

echo $CKEditor->editor("Content",$strContent, $config);

		?>
        <br />

        <input type="submit" value="提交" />

    </form>

</div>



</table>

<?php include "../bottom.php"; ?>

</body>

</html>

